package handlers

import (
	"dashboard/data"
	"encoding/json"
	"net/http"
)

const (
	current = false
	history = true
)

func IndexHandler(w http.ResponseWriter, r *http.Request) {
	http.ServeFile(w, r, "index.html")
}

func GetCurrentProblemsHandler(w http.ResponseWriter, r *http.Request) {
	w.Header().Set("Content-Type", "application/json")
	json.NewEncoder(w).Encode(data.Problems.GetProblems(current))
}

func GetHistoryProblemsHandler(w http.ResponseWriter, r *http.Request) {
	w.Header().Set("Content-Type", "application/json")
	json.NewEncoder(w).Encode(data.Problems.GetProblems(history))
}
